<template>
	<view class="mainCss">
		<view class="titleBox">
			<view class="titleLeft">
				<img src="../../static/title/back.png" class="titleBack" @click="goBack">
			</view>
			<view class="titleText">
				<text>办公出租</text>
			</view>
			<view class="titleRight">
				
			</view>
		</view>
		<view class="selectBox">
			<view class="selectBox1">
				<view class="selectIconBox">
					<img src="../../static/home/select.png" class="selectIcon">
				</view>
				<input type="text" class="selectInput" v-model="selectInfo" placeholder="请输入搜索内容" placeholder-style="color: #DFDFDF;">
			</view>
			<view class="">
				<button class="selectButton">搜索</button>
			</view>
		</view>
		<view class="bodyBox">
			<view class="bgBox">
				<view class="screenBox">
					<view class="screen" :class="[type1 == 1?'screen1':'screen']">
						<text>全苏州</text>
						<img src="../../static/lease/xia.png" class="screenIcon" v-show="type1 == 0">
						<img src="../../static/lease/xia1.png" class="screenIcon" v-show="type1 == 1">
					</view>
					<view class="screen">
						<text>价格</text>
						<img src="../../static/lease/xia.png" class="screenIcon" v-show="type2 == 0">
						<img src="../../static/lease/xia1.png" class="screenIcon" v-show="type2 == 1">
					</view>
					<view class="screen">
						<text>面积</text>
						<img src="../../static/lease/xia.png" class="screenIcon" v-show="type3 == 0">
						<img src="../../static/lease/xia1.png" class="screenIcon" v-show="type3 == 1">
					</view>
					<view class="screen">
						<text>状态</text>
						<img src="../../static/lease/xia.png" class="screenIcon" v-show="type4 == 0">
						<img src="../../static/lease/xia1.png" class="screenIcon" v-show="type4 == 1">
					</view>
				</view>
			</view>
			<view class="joinBox">
				<view class="forList" v-for="(item, index) in joinLists" :key="index">
					<view class="infoBox" @click="details" :data-id="item.ID">
						<view class="infoTextBox">
							<img :src="Url + item.FaceImage" class="infoImg">
							<span class="info-span">
								<text>{{item.Address}}</text>
								<text>{{item.Description}}</text>
								<text>{{item.Advantage}}</text>
							</span>
							<span class="info-span1">
								<text class="info-text">{{item.TradePrice}}元</text>
								<text class="info-text1">租金</text>
							</span>
						</view>
						<view class="infoUserBox">
							<span style="display: flex; align-items: center;">
								<img :src="JSON.parse(item.BasicInfo).headImg" class="userHead">
								<text style="margin-left: 15rpx; color: #999999; font-size: 12px;">发布人:{{JSON.parse(item.BasicInfo).nickName}}</text>
							</span>
							<img src="../../static/lease/more.png" class="moreIcon">
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				selectInfo:'',
				joinLists: [],
				id:'',
				openid: '',
				Url: 'https://ypsf.huashengzhuan.cn',
				// joinList: [{
				// 	title: '测试名称',
				// 	area: '生活超市',
				// 	money: '优势',
				// 	price: 1,
				// 	info: '测试简介',
				// }, {
				// 	title: '测试名称',
				// 	area: '生活超市',
				// 	money: '优势',
				// 	price: 1,
				// 	info: '测试简介',
				// }, {
				// 	title: '测试名称',
				// 	area: '生活超市',
				// 	money: '优势',
				// 	price: 1,
				// 	info: '测试简介',
				// }],
				type1: 1,
				type2: 0,
				type3: 0,
				type4: 0,
			}
		},
		onLoad() {
			this.openid = uni.getStorageSync('OpenID');
			this.$myRequest({
				url: 'getCityOffice',
				data: {
						CityDistinctID: '1013',
						SubDistrictID: '1015',
						SupplyMode: '0',
						Page: '1',
						Limit: '5',
						TradePrice_Min: 0,
						TradePrice_Max: 50000,
						Aera_Min: '0',
						Aera_Max: '500',
						TransferFee_Min: '0',
						TransferFee_Max: '50000',
						longitude: 118.263725,
						latitude: 33.974013,
						openid: 'okQn-5KR66vUUcLn_P7yRuFy-Rdg',
					},
					dataType: 'json',
			}).then(res => {
				this.joinLists = res.data;
				console.log(this.joinLists)
			})
		},
		methods: {
			// 返回
			goBack() {
				uni.navigateBack(0)
			},
			// 跳转到详情页面
			details(event) {
				if ( this.id == event.currentTarget.dataset.id) {
				      return false
				    }
				console.log(event)
				this.id = event.currentTarget.dataset.id
				console.log(this.id)
				uni.navigateTo({
					url: '/pages/lease/officeDeta?id=' + JSON.stringify(event.currentTarget.dataset.id),
				})
			},
		}
	}
</script>

<style scoped>
	@import '../../css/shopChange.css';
	.infoTextBox .info-span{
		display: flex;
		flex-direction: column;
		margin-left: 20rpx;
		color: #999999;
		font-size: 24rpx;
		justify-content: space-between;
		width: 330rpx;
	}
	.infoTextBox .info-span text{
		white-space:nowrap;
		overflow:hidden;
		text-overflow:ellipsis;
	}
	.info-span1{
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		float: right;
	}
	.info-text{
		color: red;
		font-size: 36rpx;
	}
	.info-text1{
		color: #999999;
	}
</style>